package com.summer.data.connection.source;

import com.summer.data.connection.SessionFactory;
import com.summer.data.dialect.Dialect;

import java.sql.Connection;

/**
 * @author 345480567@qq.com
 */
public class ConnectionSessionFactory extends AbstractSessionFactory implements SessionFactory {

    private final Connection connection;

    public ConnectionSessionFactory(Connection connection) {
        super(null);
        this.connection = connection;
        initDialect();
    }

    public ConnectionSessionFactory(Connection connection, Dialect dialect) {
        super(dialect);
        this.connection = connection;
        initDialect();
    }

    @Override
    public Connection getConnection() {
        return connection;
    }

}
